import Vue from 'vue'
import Vuex from 'vuex'
import persisted from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    orders: []
  },
  mutations: {
    changeOrders(state, val) {
      val.forEach(item => {
        item.state = 0
        item.check = false
      });
      state.orders = val
    },

    changeState(state, params) {
      state.orders[params.i].state = params.state
    }

    // changeCheck(state, params) {
    //   state.orders[params.i].check = params.check
    // }
  },
  actions: {
  },
  modules: {
  },

  plugins: [persisted()]
})
